// 话术创建/编辑页面逻辑
Page({
  data: {
    type: '',
    group: '',
    phrases: []
  },
  onLoad: function(options) {
    this.setData({
      type: options.type,
      group: options.group,
      phrases: [
        { title: '话术1', content: '这是话术内容1' },
        { title: '话术2', content: '这是话术内容2' }
      ] // 模拟话术数据
    })
  },
  // 创建话术
  createPhrase: function(e) {
    const { title, content } = e.detail.value
    if (title && content) {
      this.data.phrases.push({ title, content })
      this.setData({
        phrases: this.data.phrases
      })
    }
  },
  // 查看话术详情
  viewPhrase: function(e) {
    const index = e.currentTarget.dataset.index
    const phrase = this.data.phrases[index]
    wx.navigateTo({
      url: `/pages/detail/detail?title=${phrase.title}&content=${phrase.content}`,
    })
  }
})
